@extends('admin.layout.app')

@section('title', '新增用户')
@section('menu', broute('admin.index'))

@section('content')
<div class="layui-col-lg12">
    <div class="layui-card">
        <div class="layui-card-header">
            新增用户
        </div>
        <div class="layui-card-body">
            <div class="register-form">
                <form class="layui-form" method="post" action="@broute('admin.store')">
                    <div class="layui-form-item">
                        <label class="layui-form-label">工號</label>
                        <div class="layui-input-block">
                            <input type="number" name="staff_id" required lay-verify="required" placeholder="請輸入工號(10開頭)" autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">密碼</label>
                        <div class="layui-input-block">
                            <input type="password" name="password" required lay-verify="required" placeholder="請輸入密碼" autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">姓名</label>
                        <div class="layui-input-block">
                            <input type="text" name="name" required lay-verify="required" placeholder="請輸入姓名" autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">暱稱</label>
                        <div class="layui-input-block">
                            <input type="text" name="nickname" required lay-verify="required" placeholder="請輸入暱稱" autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">分機號</label>
                        <div class="layui-input-block">
                            <input type="text" name="call_id" placeholder="請輸入分機號，默認使用工號" autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">郵箱</label>
                        <div class="layui-input-block">
                            <input type="text" name="email" placeholder="請輸入郵箱" autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">角色</label>
                        <div class="layui-input-block">
                            <select lay-ignore name="roles[]" xm-select="selectId" xm-select-search="">
                                @foreach($roles??[] as $role)
                                <option value="{{$role->id}}">{{$role->name}}</option>
                                @endforeach
                            </select>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button class="layui-btn" lay-submit>
                                <i class="layui-icon layui-icon-add-1"></i>
                                增加用户
                            </button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
@endsection
